<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<button-counter title='one' v-on:myclick="myclickfun" />
			<span>hehe</span>
			</button-counter>
			<button-counter title='two' /></button-counter>
			<test></test>
		</div>
	</body>
	<script type="text/javascript">
		Vue.component('button-counter',{
			props:['title'],
			data:function(){
				return {
					count:0
				}
			},
			methods:{
				counter:function(){
					this.count++
					this.$emit('myclick',this.count)
				}
			},
			template:'<button @click="counter">click me {{title}}  {{count}} <slot/></button>',
		})
		
		var vm=new Vue({
			el:'#app',
			data:{
				
			},
			methods:{
				myclickfun:function(c){
					console.log(c);
				}
			},
			components:{
				test:{
					template:'<h1>hi component</h1>',
				}
			}
		});
	</script>
</html>
